package schoolWork.work06.test4;

import javax.swing.*;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
import java.awt.*;

public class MyInternalFrame extends JInternalFrame {
    JTextArea text;
    MyInternalFrame(String title){
        super(title,true,true,true,true);
        text = new JTextArea();
        add(new JScrollPane(text), BorderLayout.CENTER);
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        addInternalFrameListener(new InternalFrameAdapter() {
            @Override
            public void internalFrameDeiconified(InternalFrameEvent e) {
                setLayer(JDesktopPane.DEFAULT_LAYER);
            }

            @Override
            public void internalFrameDeactivated(InternalFrameEvent e) {
                setLayer(JDesktopPane.DRAG_LAYER);
            }
        });
    }
    public JTextArea getJTextArea(){
        return text;
    }
}
